<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>客户中心 - 网上银行综合管理系统</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
    <style>
        :root {
            --primary-color: #1a3a6c;
            --secondary-color: #2c5282;
            --accent-color: #38b2ac;
            --light-color: #f7fafc;
            --dark-color: #2d3748;
            --success-color: #38a169;
            --warning-color: #dd6b20;
            --danger-color: #e53e3e;
        }

        body {
            background: linear-gradient(135deg, #e6f0ff, #c9d6ff);
            font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
            min-height: 100vh;
            padding: 20px;
        }

        .client-container {
            max-width: 1200px;
            margin: 0 auto;
            background: white;
            border-radius: 12px;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
            overflow: hidden;
            border: 1px solid #e2e8f0;
        }

        .client-header {
            background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
            color: white;
            padding: 25px 30px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            position: relative;
        }

        .header-overlay {
            position: absolute;
            top: 0;
            right: 0;
            height: 100%;
            opacity: 0.1;
            pointer-events: none;
        }

        .client-welcome {
            position: relative;
            z-index: 2;
        }

        .client-welcome h2 {
            font-weight: 600;
            margin-bottom: 5px;
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .card-info {
            font-size: 1rem;
            display: flex;
            gap: 20px;
            margin-top: 10px;
        }

        .card-info .status-badge {
            background: rgba(255, 255, 255, 0.2);
            padding: 3px 10px;
            border-radius: 20px;
            font-size: 0.85rem;
        }

        .client-body {
            display: flex;
            min-height: 600px;
        }

        .client-sidebar {
            width: 250px;
            background: linear-gradient(to bottom, #2c3e50, #1a2a3a);
            color: white;
            padding: 25px 0;
            box-shadow: 5px 0 15px rgba(0, 0, 0, 0.1);
            position: relative;
            z-index: 1;
        }

        .client-content {
            flex: 1;
            padding: 30px;
            background-color: var(--light-color);
            position: relative;
            overflow: auto;
        }

        .nav-item {
            margin-bottom: 5px;
            position: relative;
        }

        .nav-link {
            color: #cbd5e0;
            padding: 14px 25px;
            border-radius: 0;
            transition: all 0.3s ease;
            display: flex;
            align-items: center;
            gap: 12px;
            font-size: 1.05rem;
            font-weight: 500;
        }

        .nav-link i {
            font-size: 1.2rem;
            width: 24px;
            text-align: center;
        }

        .nav-link:hover, .nav-link.active {
            background: linear-gradient(to right, rgba(56, 178, 172, 0.2), transparent);
            color: white;
            border-left: 4px solid var(--accent-color);
        }

        .nav-link.active {
            background: linear-gradient(to right, rgba(56, 178, 172, 0.3), transparent);
        }

        .card {
            border-radius: 12px;
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
            margin-bottom: 25px;
            border: none;
            transition: transform 0.3s ease, box-shadow 0.3s ease;
        }

        .card:hover {
            transform: translateY(-5px);
            box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
        }

        .card-header {
            background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
            color: white;
            font-weight: 600;
            border-radius: 12px 12px 0 0 !important;
            padding: 15px 20px;
            font-size: 1.1rem;
        }

        .balance-card {
            background: linear-gradient(135deg, #38b2ac, #319795);
            color: white;
            border: none;
        }

        .balance-card .card-body {
            padding: 30px 20px;
        }

        .balance-amount {
            font-size: 2.8rem;
            font-weight: 700;
            margin: 20px 0;
            text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
            letter-spacing: 1px;
        }

        .balance-label {
            font-size: 1.1rem;
            opacity: 0.9;
            margin-bottom: 5px;
        }

        .operation-section {
            display: none;
            animation: fadeIn 0.4s ease;
        }

        @keyframes fadeIn {
            from { opacity: 0; transform: translateY(10px); }
            to { opacity: 1; transform: translateY(0); }
        }

        .operation-section.active {
            display: block;
        }

        .btn-primary {
            background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
            border: none;
            padding: 10px 20px;
            font-weight: 500;
            transition: all 0.3s ease;
        }

        .btn-primary:hover {
            background: linear-gradient(135deg, var(--secondary-color), #3c6997);
            transform: translateY(-2px);
        }

        .btn-success {
            background: linear-gradient(135deg, var(--success-color), #2f855a);
            border: none;
        }

        .transaction-item {
            border-bottom: 1px solid #e2e8f0;
            padding: 16px 0;
            transition: background-color 0.2s;
        }

        .transaction-item:hover {
            background-color: rgba(247, 250, 252, 0.7);
        }

        .deposit-color {
            color: var(--success-color);
            font-weight: 600;
        }

        .withdraw-color {
            color: var(--danger-color);
            font-weight: 600;
        }

        .transfer-color {
            color: var(--secondary-color);
            font-weight: 600;
        }

        .form-control, .form-select {
            border-radius: 8px;
            padding: 10px 15px;
            border: 1px solid #cbd5e0;
            transition: all 0.3s;
        }

        .form-control:focus, .form-select:focus {
            border-color: var(--accent-color);
            box-shadow: 0 0 0 3px rgba(56, 178, 172, 0.2);
        }

        .info-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
            gap: 20px;
        }

        .info-card {
            background: white;
            border-radius: 10px;
            padding: 20px;
            box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
            border-left: 4px solid var(--accent-color);
        }

        .info-card h5 {
            color: var(--dark-color);
            font-size: 1rem;
            margin-bottom: 10px;
            font-weight: 600;
        }

        .info-card p {
            color: var(--primary-color);
            font-size: 1.2rem;
            font-weight: 600;
            margin: 0;
        }

        .action-card {
            text-align: center;
            padding: 25px 15px;
            cursor: pointer;
            transition: all 0.3s;
        }

        .action-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 10px 20px rgba(0, 0, 0, 0.08);
        }

        .action-card i {
            font-size: 2.5rem;
            margin-bottom: 15px;
            color: var(--primary-color);
        }

        .action-card h5 {
            font-weight: 600;
            margin-bottom: 5px;
        }

        .action-card p {
            color: #718096;
            font-size: 0.9rem;
        }

        .section-title {
            color: var(--primary-color);
            font-weight: 600;
            margin-bottom: 20px;
            padding-bottom: 10px;
            border-bottom: 2px solid #e2e8f0;
            position: relative;
        }

        .section-title:after {
            content: '';
            position: absolute;
            bottom: -2px;
            left: 0;
            width: 80px;
            height: 2px;
            background: var(--accent-color);
        }

        .empty-state {
            text-align: center;
            padding: 50px 20px;
            color: #a0aec0;
        }

        .empty-state i {
            font-size: 4rem;
            opacity: 0.3;
            margin-bottom: 20px;
        }

        .empty-state h4 {
            font-weight: 500;
            margin-bottom: 10px;
        }

        .logout-btn {
            background: rgba(255, 255, 255, 0.15);
            border: 1px solid rgba(255, 255, 255, 0.3);
            color: white;
            transition: all 0.3s;
            border-radius: 8px;
            padding: 8px 20px;
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .logout-btn:hover {
            background: rgba(255, 255, 255, 0.25);
            transform: translateY(-2px);
        }

        .transaction-summary {
            display: flex;
            justify-content: space-between;
            background: white;
            border-radius: 12px;
            padding: 20px;
            margin-bottom: 25px;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
        }

        .summary-item {
            text-align: center;
            flex: 1;
        }

        .summary-item h5 {
            color: #718096;
            font-size: 1rem;
            margin-bottom: 8px;
            font-weight: 500;
        }

        .summary-item .value {
            font-size: 1.8rem;
            font-weight: 700;
        }

        .summary-item .deposit {
            color: var(--success-color);
        }

        .summary-item .withdraw {
            color: var(--danger-color);
        }

        .summary-item .transfer {
            color: var(--secondary-color);
        }
    </style>
</head>
<body>
    <div class="client-container">
        <div class="client-header">
            <div class="client-welcome">
                <h2><i class="fas fa-user-circle"></i>欢迎您，{{ user.customerName }}</h2>
                <div class="card-info">
                    <span>银行卡号: {{ card.cardID }}</span>
                    <span class="status-badge">
                        <i class="fas fa-circle" style="font-size: 0.6rem; vertical-align: middle; margin-right: 5px;"></i>
                        {{ '已挂失' if card.IsReportLoss == '是' else '正常' }}
                    </span>
                </div>
            </div>
            <div>
                <button id="logoutBtn" class="btn logout-btn">
                    <i class="fas fa-sign-out-alt"></i>退出登录
                </button>
            </div>
            <div class="header-overlay">
                <i class="fas fa-piggy-bank" style="font-size: 8rem;"></i>
            </div>
        </div>

        <div class="client-body">
            <div class="client-sidebar">
                <ul class="nav flex-column">
                    <li class="nav-item">
                        <a href="#" class="nav-link active" data-target="balance">
                            <i class="fas fa-wallet"></i> 账户余额
                        </a>
                    </li>
                    <li class="nav-item">
                        <a href="#" class="nav-link" data-target="deposit">
                            <i class="fas fa-money-bill-wave"></i> 存款
                        </a>
                    </li>
                    <li class="nav-item">
                        <a href="#" class="nav-link" data-target="withdraw">
                            <i class="fas fa-hand-holding-usd"></i> 取款
                        </a>
                    </li>
                    <li class="nav-item">
                        <a href="#" class="nav-link" data-target="transfer">
                            <i class="fas fa-exchange-alt"></i> 转账
                        </a>
                    </li>
                    <li class="nav-item">
                        <a href="#" class="nav-link" data-target="transactions">
                            <i class="fas fa-list"></i> 交易记录
                        </a>
                    </li>
                    <li class="nav-item">
                        <a href="#" class="nav-link" data-target="reportLoss">
                            <i class="fas fa-ban"></i> 挂失银行卡
                        </a>
                    </li>
                    <li class="nav-item">
                        <a href="#" class="nav-link" data-target="changePassword">
                            <i class="fas fa-key"></i> 修改密码
                        </a>
                    </li>
                </ul>
            </div>

            <div class="client-content">
                <!-- 账户余额 -->
                <div id="balance" class="operation-section active">
                    <div class="card balance-card">
                        <div class="card-body text-center">
                            <div class="balance-label">账户余额</div>
                            <div class="balance-amount">¥ {{ card.balance }}</div>
                            <div class="text-white-50">最后更新: {{ card.openDate.strftime('%Y-%m-%d %H:%M:%S') }}</div>
                        </div>
                    </div>

                    <h3 class="section-title">快捷操作</h3>
                    <div class="row row-cols-1 row-cols-md-3 g-4 mb-4">
                        <div class="col">
                            <div class="card action-card h-100" data-target="deposit">
                                <div class="card-body">
                                    <i class="fas fa-money-bill-wave text-success"></i>
                                    <h5>存款</h5>
                                    <p>向账户存入资金</p>
                                </div>
                            </div>
                        </div>
                        <div class="col">
                            <div class="card action-card h-100" data-target="withdraw">
                                <div class="card-body">
                                    <i class="fas fa-hand-holding-usd text-danger"></i>
                                    <h5>取款</h5>
                                    <p>从账户提取资金</p>
                                </div>
                            </div>
                        </div>
                        <div class="col">
                            <div class="card action-card h-100" data-target="transfer">
                                <div class="card-body">
                                    <i class="fas fa-exchange-alt text-primary"></i>
                                    <h5>转账</h5>
                                    <p>向他人转账资金</p>
                                </div>
                            </div>
                        </div>
                    </div>

                    <h3 class="section-title">个人信息</h3>
                    <div class="info-grid mb-4">
                        <div class="info-card">
                            <h5>客户编号</h5>
                            <p>{{ user.customerID }}</p>
                        </div>
                        <div class="info-card">
                            <h5>姓名</h5>
                            <p>{{ user.customerName }}</p>
                        </div>
                        <div class="info-card">
                            <h5>身份证号</h5>
                            <p>{{ user.PID }}</p>
                        </div>
                        <div class="info-card">
                            <h5>联系电话</h5>
                            <p>{{ user.telephone }}</p>
                        </div>
                        <div class="info-card">
                            <h5>联系地址</h5>
                            <p>{{ user.address }}</p>
                        </div>
                    </div>

                    <h3 class="section-title">最近交易</h3>
                    <div id="recentTransactions" class="card">
                        <div class="card-body">
                            <div id="recentTransactionsList">
                                <div class="text-center py-4">
                                    <div class="spinner-border text-primary" role="status">
                                        <span class="visually-hidden">Loading...</span>
                                    </div>
                                    <p class="mt-2">正在加载交易记录...</p>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>

                <!-- 存款 -->
                <div id="deposit" class="operation-section">
                    <h3 class="section-title">存款操作</h3>
                    <div class="row">
                        <div class="col-lg-6">
                            <div class="card">
                                <div class="card-header">存款信息</div>
                                <div class="card-body">
                                    <form id="depositForm">
                                        <div class="mb-4">
                                            <label class="form-label">存款金额 (元)</label>
                                            <input type="number" class="form-control form-control-lg" name="amount" min="0.01" step="0.01" required placeholder="请输入存款金额">
                                        </div>
                                        <div class="mb-4">
                                            <label class="form-label">备注信息</label>
                                            <input type="text" class="form-control" name="remark" placeholder="存款备注（可选）">
                                        </div>
                                        <button type="submit" class="btn btn-primary w-100 py-3">
                                            <i class="fas fa-check me-2"></i> 确认存款
                                        </button>
                                    </form>
                                </div>
                            </div>
                        </div>
                        <div class="col-lg-6">
                            <div class="card h-100">
                                <div class="card-header">存款说明</div>
                                <div class="card-body">
                                    <div class="alert alert-success">
                                        <h5><i class="fas fa-info-circle me-2"></i>存款指南</h5>
                                        <ul class="mt-3">
                                            <li>存款操作实时到账，资金即时可用</li>
                                            <li>存款金额必须大于0，支持小数点后两位</li>
                                            <li>存款无手续费，无金额上限</li>
                                            <li>存款记录可在交易记录中查询</li>
                                        </ul>
                                    </div>
                                    <div class="d-flex align-items-center mt-4 p-3 bg-light rounded">
                                        <i class="fas fa-shield-alt fa-2x text-primary me-3"></i>
                                        <div>
                                            <h5>安全提示</h5>
                                            <p class="mb-0">请确保您的操作环境安全，不要在公共网络下进行交易</p>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>

                <!-- 取款 -->
                <div id="withdraw" class="operation-section">
                    <h3 class="section-title">取款操作</h3>
                    <div class="row">
                        <div class="col-lg-6">
                            <div class="card">
                                <div class="card-header">取款信息</div>
                                <div class="card-body">
                                    <form id="withdrawForm">
                                        <div class="mb-4">
                                            <label class="form-label">取款金额 (元)</label>
                                            <input type="number" class="form-control form-control-lg" name="amount" min="0.01" step="0.01" required placeholder="请输入取款金额">
                                        </div>
                                        <div class="mb-4">
                                            <label class="form-label">备注信息</label>
                                            <input type="text" class="form-control" name="remark" placeholder="取款备注（可选）">
                                        </div>
                                        <button type="submit" class="btn btn-primary w-100 py-3">
                                            <i class="fas fa-check me-2"></i> 确认取款
                                        </button>
                                    </form>
                                </div>
                            </div>
                        </div>
                        <div class="col-lg-6">
                            <div class="card h-100">
                                <div class="card-header">账户信息</div>
                                <div class="card-body">
                                    <div class="d-flex justify-content-between align-items-center mb-4 p-3 bg-light rounded">
                                        <div>
                                            <div class="text-muted small">可用余额</div>
                                            <div class="fs-3 fw-bold">¥ {{ card.balance }}</div>
                                        </div>
                                        <i class="fas fa-wallet fa-2x text-primary"></i>
                                    </div>

                                    <div class="alert alert-warning">
                                        <h5><i class="fas fa-exclamation-triangle me-2"></i>重要提示</h5>
                                        <ul class="mt-3">
                                            <li>单笔取款金额不能超过账户可用余额</li>
                                            <li>每日取款限额为50,000元</li>
                                            <li>取款操作即时生效，资金实时扣除</li>
                                            <li>请确保您有足够的余额进行取款操作</li>
                                        </ul>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>

                <!-- 转账 -->
                <div id="transfer" class="operation-section">
                    <h3 class="section-title">转账操作</h3>
                    <div class="row">
                        <div class="col-lg-6">
                            <div class="card">
                                <div class="card-header">转账信息</div>
                                <div class="card-body">
                                    <form id="transferForm">
                                        <div class="mb-4">
                                            <label class="form-label">目标银行卡号</label>
                                            <input type="text" class="form-control form-control-lg" name="toCardID" required placeholder="请输入对方银行卡号">
                                        </div>
                                        <div class="mb-4">
                                            <label class="form-label">转账金额 (元)</label>
                                            <input type="number" class="form-control form-control-lg" name="amount" min="0.01" step="0.01" required placeholder="请输入转账金额">
                                        </div>
                                        <div class="mb-4">
                                            <label class="form-label">备注信息</label>
                                            <textarea class="form-control" name="remark" rows="2" placeholder="转账备注（可选）"></textarea>
                                        </div>
                                        <button type="submit" class="btn btn-primary w-100 py-3">
                                            <i class="fas fa-exchange-alt me-2"></i> 确认转账
                                        </button>
                                    </form>
                                </div>
                            </div>
                        </div>
                        <div class="col-lg-6">
                            <div class="card h-100">
                                <div class="card-header">转账说明</div>
                                <div class="card-body">
                                    <div class="d-flex justify-content-between align-items-center mb-4 p-3 bg-light rounded">
                                        <div>
                                            <div class="text-muted small">可用余额</div>
                                            <div class="fs-3 fw-bold">¥ {{ card.balance }}</div>
                                        </div>
                                        <i class="fas fa-money-check-alt fa-2x text-success"></i>
                                    </div>

                                    <div class="alert alert-info">
                                        <h5><i class="fas fa-info-circle me-2"></i>转账须知</h5>
                                        <ul class="mt-3">
                                            <li>转账操作即时生效，资金实时到账</li>
                                            <li>单笔转账限额为100,000元</li>
                                            <li>每日累计转账限额为500,000元</li>
                                            <li>转账手续费为0，无额外费用</li>
                                            <li>请仔细核对收款方银行卡号</li>
                                        </ul>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>

                <!-- 交易记录 -->
                <div id="transactions" class="operation-section">
                    <div class="d-flex justify-content-between align-items-center mb-4">
                        <h3 class="section-title mb-0">交易记录</h3>
                        <a href="{{ url_for('client.export_transactions') }}" class="btn btn-success">
                            <i class="fas fa-file-export me-2"></i> 导出CSV
                        </a>
                    </div>

                    <div class="transaction-summary">
                        <div class="summary-item">
                            <h5>存款总额</h5>
                            <div class="value deposit">¥12,500.00</div>
                        </div>
                        <div class="summary-item">
                            <h5>取款总额</h5>
                            <div class="value withdraw">¥3,200.00</div>
                        </div>
                        <div class="summary-item">
                            <h5>转账总额</h5>
                            <div class="value transfer">¥8,000.00</div>
                        </div>
                    </div>

                    <div class="card">
                        <div class="card-header d-flex justify-content-between align-items-center">
                            <span>交易明细</span>
                            <div class="d-flex gap-2">
                                <select class="form-select form-select-sm w-auto">
                                    <option>最近7天</option>
                                    <option selected>最近30天</option>
                                    <option>最近90天</option>
                                    <option>全部记录</option>
                                </select>
                                <select class="form-select form-select-sm w-auto">
                                    <option selected>全部类型</option>
                                    <option>存款</option>
                                    <option>取款</option>
                                    <option>转账</option>
                                </select>
                            </div>
                        </div>
                        <div class="card-body">
                            <div id="transactionsList">
                                <div class="text-center py-5">
                                    <div class="spinner-border text-primary" role="status">
                                        <span class="visually-hidden">Loading...</span>
                                    </div>
                                    <p class="mt-2">正在加载交易记录...</p>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>

                <!-- 挂失银行卡 -->
                <div id="reportLoss" class="operation-section">
                    <h3 class="section-title">银行卡挂失</h3>
                    <div class="row">
                        <div class="col-lg-8">
                            <div class="card">
                                <div class="card-body">
                                    <div class="alert alert-danger">
                                        <h4><i class="fas fa-exclamation-triangle me-2"></i>重要提示</h4>
                                        <p class="mb-0">挂失操作将立即冻结您的银行卡，冻结后将无法进行任何交易操作。</p>
                                    </div>

                                    <div class="d-flex align-items-center mt-4 p-4 bg-light rounded">
                                        <div class="me-4">
                                            <i class="fas fa-credit-card fa-3x text-primary"></i>
                                        </div>
                                        <div>
                                            <h5>银行卡信息</h5>
                                            <div class="d-flex gap-4 mt-2">
                                                <div>
                                                    <div class="text-muted small">卡号</div>
                                                    <div class="fw-bold">{{ card.cardID }}</div>
                                                </div>
                                                <div>
                                                    <div class="text-muted small">状态</div>
                                                    <div class="fw-bold">{{ '已挂失' if card.IsReportLoss == '是' else '正常' }}</div>
                                                </div>
                                                <div>
                                                    <div class="text-muted small">余额</div>
                                                    <div class="fw-bold">¥ {{ card.balance }}</div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>

                                    <div class="mt-4 p-4 border rounded">
                                        <h5><i class="fas fa-shield-alt me-2 text-primary"></i>安全验证</h5>
                                        <p class="mb-3">为了确保是您本人操作，请验证您的身份</p>

                                        <div class="mb-3">
                                            <label class="form-label">身份证号码</label>
                                            <input type="text" class="form-control" value="{{ user.PID }}" readonly>
                                        </div>
                                        <div class="mb-3">
                                            <label class="form-label">手机号码</label>
                                            <input type="text" class="form-control" value="{{ user.telephone }}" readonly>
                                        </div>
                                        <div class="mb-3">
                                            <label class="form-label">登录密码</label>
                                            <input type="password" class="form-control" placeholder="请输入登录密码">
                                        </div>

                                        <button id="reportLossBtn" class="btn btn-danger w-100 py-3 mt-2">
                                            <i class="fas fa-ban me-2"></i> 确认挂失
                                        </button>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="col-lg-4">
                            <div class="card h-100">
                                <div class="card-header">挂失说明</div>
                                <div class="card-body">
                                    <div class="alert alert-warning">
                                        <h5><i class="fas fa-info-circle me-2"></i>挂失须知</h5>
                                        <ul class="mt-3">
                                            <li>挂失后银行卡将立即冻结，无法进行任何交易</li>
                                            <li>挂失后需本人携带有效证件到银行柜台办理解挂</li>
                                            <li>解挂后银行卡将恢复正常使用</li>
                                            <li>如银行卡已找回，请及时办理解挂手续</li>
                                        </ul>
                                    </div>
                                    <div class="d-flex align-items-center mt-4 p-3 bg-light rounded">
                                        <i class="fas fa-phone-alt fa-2x text-primary me-3"></i>
                                        <div>
                                            <h5>客服支持</h5>
                                            <p class="mb-0">如有疑问，请拨打客服热线: 95588</p>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>

                <!-- 修改密码 -->
                <div id="changePassword" class="operation-section">
                    <h3 class="section-title">修改密码</h3>
                    <div class="row">
                        <div class="col-lg-6">
                            <div class="card">
                                <div class="card-header">密码修改</div>
                                <div class="card-body">
                                    <form id="changePasswordForm">
                                        <div class="mb-4">
                                            <label class="form-label">原密码</label>
                                            <input type="password" class="form-control form-control-lg" name="oldPassword" required placeholder="请输入原密码">
                                        </div>
                                        <div class="mb-4">
                                            <label class="form-label">新密码</label>
                                            <input type="password" class="form-control form-control-lg" name="newPassword" required placeholder="请输入新密码">
                                        </div>
                                        <div class="mb-4">
                                            <label class="form-label">确认新密码</label>
                                            <input type="password" class="form-control form-control-lg" name="confirmPassword" required placeholder="请再次输入新密码">
                                        </div>
                                        <button type="submit" class="btn btn-primary w-100 py-3">
                                            <i class="fas fa-key me-2"></i> 确认修改
                                        </button>
                                    </form>
                                </div>
                            </div>
                        </div>
                        <div class="col-lg-6">
                            <div class="card h-100">
                                <div class="card-header">安全指南</div>
                                <div class="card-body">
                                    <div class="alert alert-info">
                                        <h5><i class="fas fa-lock me-2"></i>密码安全提示</h5>
                                        <ul class="mt-3">
                                            <li>请勿使用简单密码（如123456、生日等）</li>
                                            <li>建议使用字母、数字和特殊字符组合</li>
                                            <li>密码长度至少8位</li>
                                            <li>不要将密码告诉他人</li>
                                            <li>定期更换密码以提高安全性</li>
                                        </ul>
                                    </div>

                                    <div class="d-flex align-items-center mt-4 p-3 bg-light rounded">
                                        <i class="fas fa-shield-alt fa-2x text-primary me-3"></i>
                                        <div>
                                            <h5>安全等级</h5>
                                            <div class="progress mt-2" style="height: 10px;">
                                                <div class="progress-bar bg-success" role="progressbar" style="width: 75%"></div>
                                            </div>
                                            <div class="mt-2 text-muted small">当前密码安全等级: 中等</div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
    <script>
        $(document).ready(function() {
            // 导航菜单切换
            $('.nav-link').click(function(e) {
                e.preventDefault();
                $('.nav-link').removeClass('active');
                $(this).addClass('active');

                const target = $(this).data('target');
                $('.operation-section').removeClass('active');
                $('#' + target).addClass('active');

                // 加载交易记录
                if (target === 'transactions') {
                    loadTransactions();
                }
            });

            // 快捷操作卡片点击
            $('.action-card').click(function() {
                const target = $(this).data('target');
                $('.nav-link').removeClass('active');
                $(`.nav-link[data-target="${target}"]`).addClass('active');

                $('.operation-section').removeClass('active');
                $(`#${target}`).addClass('active');

                // 如果是交易记录，加载数据
                if (target === 'transactions') {
                    loadTransactions();
                }
            });

            // 存款操作
            $('#depositForm').submit(function(e) {
                e.preventDefault();
                $.ajax({
                    url: "{{ url_for('client.deposit') }}",
                    method: 'POST',
                    data: $(this).serialize(),
                    success: function(response) {
                        if (response.success) {
                            alert('存款成功');
                            $('#depositForm')[0].reset();
                            // 刷新余额
                            location.reload();
                        } else {
                            alert('存款失败: ' + response.message);
                        }
                    }
                });
            });

            // 取款操作
            $('#withdrawForm').submit(function(e) {
                e.preventDefault();
                $.ajax({
                    url: "{{ url_for('client.withdraw') }}",
                    method: 'POST',
                    data: $(this).serialize(),
                    success: function(response) {
                        if (response.success) {
                            alert('取款成功');
                            $('#withdrawForm')[0].reset();
                            // 刷新余额
                            location.reload();
                        } else {
                            alert('取款失败: ' + response.message);
                        }
                    }
                });
            });

            // 转账操作
            $('#transferForm').submit(function(e) {
                e.preventDefault();
                $.ajax({
                    url: "{{ url_for('client.transfer') }}",
                    method: 'POST',
                    data: $(this).serialize(),
                    success: function(response) {
                        if (response.success) {
                            alert('转账成功');
                            $('#transferForm')[0].reset();
                            // 刷新余额
                            location.reload();
                        } else {
                            alert('转账失败: ' + response.message);
                        }
                    }
                });
            });

            // 挂失操作
            $('#reportLossBtn').click(function() {
                if (confirm('确定要挂失此银行卡吗？挂失后将无法进行任何交易操作！')) {
                    $.ajax({
                        url: "{{ url_for('client.report_loss') }}",
                        method: 'POST',
                        success: function(response) {
                            if (response.success) {
                                alert('银行卡挂失成功');
                                location.reload();
                            } else {
                                alert('挂失失败: ' + response.message);
                            }
                        }
                    });
                }
            });

            // 修改密码
            $('#changePasswordForm').submit(function(e) {
                e.preventDefault();
                const newPassword = $('input[name="newPassword"]').val();
                const confirmPassword = $('input[name="confirmPassword"]').val();

                if (newPassword !== confirmPassword) {
                    alert('两次输入的新密码不一致');
                    return;
                }

                if (newPassword.length < 6) {
                    alert('密码长度至少为6位');
                    return;
                }

                $.ajax({
                    url: "{{ url_for('client.change_password') }}",
                    method: 'POST',
                    data: $(this).serialize(),
                    success: function(response) {
                        if (response.success) {
                            alert('密码修改成功，请重新登录');
                            window.location.href = "{{ url_for('auth.logout') }}";
                        } else {
                            alert('密码修改失败: ' + response.message);
                        }
                    }
                });
            });

            // 退出登录
            $('#logoutBtn').click(function() {
                window.location.href = "{{ url_for('auth.logout') }}";
            });

            // 加载交易记录（完整）
            function loadTransactions() {
                $.ajax({
                    url: "{{ url_for('client.get_transactions') }}",
                    method: 'GET',
                    success: function(response) {
                        if (response.success) {
                            const transactions = response.data;
                            let html = '';

                            if (transactions.length === 0) {
                                html = `
                                    <div class="empty-state">
                                        <i class="fas fa-file-invoice"></i>
                                        <h4>暂无交易记录</h4>
                                        <p>您还没有任何交易记录</p>
                                    </div>
                                `;
                            } else {
                                transactions.forEach(t => {
                                    let typeClass = '';
                                    let icon = '';
                                    let sign = '';

                                    if (t.type === '存款') {
                                        typeClass = 'deposit-color';
                                        icon = '<i class="fas fa-arrow-down me-2"></i>';
                                        sign = '+';
                                    } else if (t.type === '取款') {
                                        typeClass = 'withdraw-color';
                                        icon = '<i class="fas fa-arrow-up me-2"></i>';
                                        sign = '-';
                                    } else {
                                        typeClass = 'transfer-color';
                                        icon = '<i class="fas fa-exchange-alt me-2"></i>';
                                        sign = t.amount > 0 ? '+' : '-';
                                    }

                                    html += `
                                        <div class="transaction-item">
                                            <div class="d-flex justify-content-between align-items-center">
                                                <div class="d-flex align-items-center">
                                                    <div class="bg-light rounded-circle p-3 me-3">
                                                        <span class="${typeClass}">${icon}</span>
                                                    </div>
                                                    <div>
                                                        <div class="fw-bold ${typeClass}">${t.type}</div>
                                                        <div class="text-muted small">${t.date}</div>
                                                    </div>
                                                </div>
                                                <div class="fw-bold ${typeClass}">${sign}¥${Math.abs(t.amount).toFixed(2)}</div>
                                            </div>
                                            <div class="mt-2 ps-5 text-muted">
                                                <i class="fas fa-comment me-2"></i>${t.remark || '无备注信息'}
                                            </div>
                                        </div>
                                    `;
                                });
                            }

                            $('#transactionsList').html(html);
                        } else {
                            $('#transactionsList').html(`
                                <div class="alert alert-danger">
                                    ${response.message || '加载交易记录失败'}
                                </div>
                            `);
                        }
                    }
                });
            }

            // 加载最近交易记录（首页）
            function loadRecentTransactions() {
                $.ajax({
                    url: "{{ url_for('client.get_transactions') }}",
                    method: 'GET',
                    success: function(response) {
                        if (response.success) {
                            const transactions = response.data.slice(0, 5); // 只取最近5条
                            let html = '';

                            if (transactions.length === 0) {
                                html = `
                                    <div class="empty-state py-4">
                                        <i class="fas fa-file-invoice fa-2x"></i>
                                        <h4>暂无交易记录</h4>
                                        <p>您还没有任何交易记录</p>
                                    </div>
                                `;
                            } else {
                                transactions.forEach(t => {
                                    let typeClass = '';
                                    let sign = '';

                                    if (t.type === '存款') {
                                        typeClass = 'deposit-color';
                                        sign = '+';
                                    } else if (t.type === '取款') {
                                        typeClass = 'withdraw-color';
                                        sign = '-';
                                    } else {
                                        typeClass = 'transfer-color';
                                        sign = t.amount > 0 ? '+' : '-';
                                    }

                                    html += `
                                        <div class="transaction-item">
                                            <div class="d-flex justify-content-between align-items-center">
                                                <div>
                                                    <div class="fw-bold ${typeClass}">${t.type}</div>
                                                    <div class="text-muted small">${t.date}</div>
                                                </div>
                                                <div class="fw-bold ${typeClass}">${sign}¥${Math.abs(t.amount).toFixed(2)}</div>
                                            </div>
                                            <div class="mt-2 text-muted small">${t.remark || '无备注信息'}</div>
                                        </div>
                                    `;
                                });
                            }

                            $('#recentTransactionsList').html(html);
                        } else {
                            $('#recentTransactionsList').html(`
                                <div class="alert alert-danger">
                                    ${response.message || '加载交易记录失败'}
                                </div>
                            `);
                        }
                    }
                });
            }

            // 页面加载时获取最近交易记录
            loadRecentTransactions();
        });
    </script>
</body>
</html>